package org.jivesoftware.smack;

import android.os.Build.VERSION;
import java.io.File;
import java.util.List;
import org.jivesoftware.smack.proxy.ProxyInfo;
import org.jivesoftware.smack.util.DNSUtil;
import org.jivesoftware.smack.util.dns.HostAddress;

public class AndroidConnectionConfiguration extends ConnectionConfiguration
{
  private static final int DEFAULT_TIMEOUT = 10000;

  public AndroidConnectionConfiguration(String paramString)
    throws XMPPException
  {
    AndroidInit(paramString, 10000);
  }

  public AndroidConnectionConfiguration(String paramString, int paramInt)
    throws XMPPException
  {
    AndroidInit(paramString, paramInt);
  }

  public AndroidConnectionConfiguration(String paramString1, int paramInt, String paramString2)
  {
    super(paramString1, paramInt, paramString2);
    AndroidInit();
  }

  private void AndroidInit()
  {
    if (Build.VERSION.SDK_INT >= 14)
    {
      setTruststoreType("AndroidCAStore");
      setTruststorePassword(null);
      setTruststorePath(null);
    }
    else
    {
      setTruststoreType("BKS");
      String str = System.getProperty("javax.net.ssl.trustStore");
      if (str == null)
        str = System.getProperty("java.home") + File.separator + "etc" + File.separator + "security" + File.separator + "cacerts.bks";
      setTruststorePath(str);
    }
  }

  private void AndroidInit(String paramString, int paramInt)
    throws XMPPException
  {
    AndroidInit();
    Runnable local1DnsSrvLookupRunnable = new Runnable()
    {
      String serviceName;
      List<HostAddress> addresses;

      public void run()
      {
        this.addresses = DNSUtil.resolveXMPPDomain(this.serviceName);
      }

      public List<HostAddress> getHostAddresses()
      {
        return this.addresses;
      }
    };
    Thread localThread = new Thread(local1DnsSrvLookupRunnable, "dns-srv-lookup");
    localThread.start();
    try
    {
      localThread.join(paramInt);
    }
    catch (InterruptedException localInterruptedException)
    {
      throw new XMPPException("DNS lookup timeout after " + paramInt + "ms", localInterruptedException);
    }
    this.hostAddresses = local1DnsSrvLookupRunnable.getHostAddresses();
    if (this.hostAddresses == null)
      throw new XMPPException("DNS lookup failure");
    ProxyInfo localProxyInfo = ProxyInfo.forDefaultProxy();
    init(paramString, localProxyInfo);
  }
}

/* Location:           D:\hygieia\userclient\common\libs\easemobchat_2.1.8.jar
 * Qualified Name:     org.jivesoftware.smack.AndroidConnectionConfiguration
 * JD-Core Version:    0.6.1
 */